using DEL.Gzh;
using Microsoft.AspNetCore.Mvc;
using System.Linq;

namespace Web.Areas.Gzh.Controllers
{
    public class YWController : GzhController<YW>
    {
        protected override void SetCurrentEntityService()
        {
            CurrentEntityService = BLLFactory.SetYWService();
        }

        public IActionResult YWLB()
        {
            return View();
        }

        public IActionResult GetYwByYwlb(int ywlbId = 0, int pageIndex = 1)
        {
            var rowCount = 0;
            var totalPages = 0;
            var result = CurrentEntityService.GetPagedEntitysByLambdaAndSort(pageIndex, PageSize, out rowCount, out totalPages, o => o.YwlbId == ywlbId, o => o.SortIndex, true).ToList();

            return Json(new
            {
                rowCount = rowCount,
                pageCount = totalPages,
                rows = result,
            });
        }

        
    }
}